﻿namespace NKernel.Core.Tests
{
    using System;
    using System.Reflection;
    using System.Collections.Generic;

    using NUnit.Framework;

    [TestFixture]
    public class TestGenericInterfaceReflection
    {
        #region Methods

        [Test]
        public void Test()
        {
            Console.WriteLine("Running the generic reflection test...");
            Type type = Type.GetType("System.Collections.Generic.List`1[System.String]");
            Console.WriteLine("Type: " + type);
            object instance = Activator.CreateInstance(type);
            Console.WriteLine("Instance: " + instance);
            Assert.IsNotNull(instance);

            List<string> list = instance as List<string>;
            Assert.IsInstanceOf(typeof(List<string>), list, "Testing the List<string>");

            IGenericReflection<string> genericTest = new GenericRelectionInstance();
            //        	Type genericType = genericTest.GetType();
            //Type interfaceType = genericTest.GetType();
            Console.WriteLine("Instance: " + genericTest.GetType());
            Console.WriteLine("Interface: " + typeof(IGenericReflection<string>));
            
//            Type genericInterface = Assembly.GetAssembly(Type.GetType("NKernel.Core.Tests.IGenericReflection`1[System.String]", true, false));
//            Console.WriteLine("Generated Type: " + genericInterface + "{end}");
        }

        #endregion Methods
    }
}